/*
 * @FileName: bsp_uart.h
 * @Author: GreyQiu qiushaogui@aikosolar.com
 * @Date: 2023-08-21 10:50:15
 * @LastEditors: GreyQiu qiushaogui@aikosolar.com
 * @LastEditTime: 2023-08-21 16:53:25
 * @Description: 
 * 
 * Copyright (c) 2023, All Rights Reserved. 
 */

#ifndef __BSP_UART_H__
#define __BSP_UART_H__

#include "n32g430.h"
#include "stddef.h"

#define WIFI_USARTx     USART1
#define DEBUG_USARTx    USART2

#define BAUDRATE_WIFI   (115200)
#define BAUDRATE_DEBUG  (115200)

#define WIFI_TX_DMA_Channel   DMA_CH4
#define WIFI_TX_DMA_FLAG      DMA_CH4_TXCF
#define WIFI_RX_DMA_Channel   DMA_CH5
#define WIFI_RX_DMA_FLAG      DMA_CH5_TXCF

#define WIFI_TX_LEN_MAX 64
#define WIFI_RX_LEN_MAX (2048 + 64)

typedef void (*uart_rx_complete_calllback)(uint8_t * rx_buffer, uint32_t len);

void bsp_uart_init(void);
void bsp_wifi_uart_send(uint8_t * buffer, uint32_t len);
void bsp_wifi_uart_callback_register(uart_rx_complete_calllback cb);

#endif
